Phasor estimation algorithm